#define _CRT_SECURE_NO_WARNINGS 1
//用函数实现二分查找
#include<stdio.h>

int binary_search(int x[10], int n,int num)
{
	int right = n - 1;
	int left = 0;
	int mid = (right + left) / 2;
	while (left <= right)
	{
		mid = (right + left) / 2;
		if (x[mid] < num)
		{
			left = mid + 1;
		}
		else if(x[mid] > num)
		{
			right = mid - 1;
		}
		else
		{
			return mid;
		}
	}
	return -1;
}



int main()
{
	int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int num = 0;
	scanf("%d", &num);
	int ret = binary_search(arr, sz,num);
	printf("%d\n", ret);
	return 0;
}